import time
def read2list(file):
    file = open(file, 'r')
    l = file.readlines()
    return(l)

def bubble(a):
    for i in range(len(a)-1):
        for j in range(len(a)-2, i-1, -1):
            if a [j] > a [j+1]:
                a[j], a[j+1] = a[j+1], a[j]

m1 = read2list('m1_sorted.txt')
start = time.time()
bubble(m1)
finish = time.time()
print ("m1_sorted", (finish - start)*1000, 'milliseconds')

m2 = read2list('m2_sorted.txt')
start2 = time.time()
bubble(m2)
finish2 = time.time()
print ("m2_sorted", (finish2 - start2)*1000, 'milliseconds')

m3 = read2list('m3_sorted.txt')
start3 = time.time()
bubble(m3)
finish3 = time.time()
print ("m3_sorted", (finish3 - start3)*1000, 'milliseconds')
